<?php
class IndexAction extends BaseAction{
	
	public function _initialize() {
		parent::_initialize();
	}

	public function _after_Index(){
		//echo "do _after_action<br>";
	} 

	public function index() {
		//$docid = 5;
		//if(empty($docid))$this->error('请求参数有误！');
		//$helpdoc = service('Common')->getDocById($docid);
		//$this->assign('helpdoc', $helpdoc);
		$this->display();
	}
	
	/**
     * 重新发送礼券
     */
    public function resendCoupon(){
    	$sendRole='receiver';
    	$id=$_REQUEST['id'];
    	$oid=$_REQUEST['oid'];
    	$mobile = $_REQUEST['mobile'];
    	$result = service('Coupon')->selectCouponReSend4User($id,$oid,$sendRole,$mobile);
    	if($result['status']==1){
			//发送可以发送的商品券
			$sendcenter = service('SendCenter');
			$senData = $sendcenter->parseCouponSendData($result['data']);
			$sendcenter->send($senData);
			$result=array('status'=>1,'msg'=>'发送成功！');
		}
    	exit(json_encode($result));
    }
    
    public function help(){
    	$docid = 3;
		//if(empty($docid))$this->error('请求参数有误！');
		$helpdoc = service('Common')->getDocById($docid);
		$this->assign('helpdoc', $helpdoc);
		$this->display();
    }
	
}
